﻿using Coolzon.UI.Core.Parts;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using System.Windows.Media.Animation;

namespace Coolzon.UI.Core.Runtime.Script.Animation
{
    public class SequenceAnimationScriptObject : AnimationScriptObject
    {
        List<AnimationScriptObject> _animations = new List<AnimationScriptObject>();

        public SequenceAnimationScriptObject(params object[] animations)
            : base(0)
        {
            foreach (var animation in animations)
            {
                _animations.Add((AnimationScriptObject)animation);
            }
        }

        public override void AppendToStoryboard(Widget instance, ref double duration, Storyboard storyboard)
        {
            for (int index = 0; index < _animations.Count; index++)
            {
                _animations[index].AppendToStoryboard(instance, ref duration, storyboard);
            }
        }
    }
}
